#pragma once
#include "winboost.hpp"

namespace winboost {
   namespace resources {


class font
{
   typedef boost::shared_ptr<Gdiplus::FontFamily> font_family_t;
   typedef boost::shared_ptr<Gdiplus::Font> font_t;
   typedef boost::shared_ptr<Gdiplus::SolidBrush> solid_brush_t;
   typedef boost::shared_ptr<Gdiplus::StringFormat> string_format_t;

public:
   font(void):
     m_size(12)
   , m_face_name(L"Tahoma")
   , m_style(Gdiplus::FontStyleRegular)
   , m_alignment(Gdiplus::StringAlignmentNear)
   {
      m_color.SetFromCOLORREF(::GetSysColor(COLOR_WINDOWTEXT));
   }

   std::wstring get_name() const { return m_face_name; }
   void set_name(std::wstring val) { m_face_name = val; }
   short get_size() const { return m_size; }
   void set_size(short val) { m_size = val; }
   Gdiplus::FontStyle get_style() const { return m_style; }
   void set_style(Gdiplus::FontStyle val) { m_style = val; }
   Gdiplus::Color get_color() const { return m_color; }
   void set_color(Gdiplus::Color val) { m_color = val; }
   Gdiplus::StringAlignment get_alignment() const { return m_alignment; }
   void set_alignment(Gdiplus::StringAlignment val) { m_alignment = val; }

   void reset(void)
   {
      m_family = font_family_t(new Gdiplus::FontFamily(m_face_name.c_str()));
      m_font = font_t(new Gdiplus::Font(m_family.get(), m_size, m_style, Gdiplus::UnitPixel));
      m_solid_brush = solid_brush_t(new Gdiplus::SolidBrush(m_color));
      m_format = string_format_t(new Gdiplus::StringFormat);
      m_format->SetAlignment(m_alignment);
   }

   Gdiplus::Font* get_font(void) const { return m_font.get(); }
   Gdiplus::Brush* get_brush(void) const { return m_solid_brush.get();}
   Gdiplus::StringFormat* get_format(void) const { return m_format.get(); }

private:
   font_family_t m_family;
   font_t m_font;
   solid_brush_t m_solid_brush;
   string_format_t m_format;

   std::wstring m_face_name;
   short m_size;
   Gdiplus::FontStyle m_style;
   Gdiplus::Color m_color;
   Gdiplus::StringAlignment m_alignment;
   
};

   }// resources
} // winboost
